github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/tests/manual_testing/many controls/queries/q12.sql (about)

     1  select
     2      -- Required Columns
     3      arn as resource,
     4      case
     5          when o ->> 'DomainName' not like '%s3.amazonaws.com' then 'skip'
     6          when o ->> 'DomainName' like '%s3.amazonaws.com'
     7              and o -> 'S3OriginConfig' ->> 'OriginAccessIdentity' = '' then 'alarm'
     8          else 'ok'
     9          end as status,
    10      case
    11          when o ->> 'DomainName' not like '%s3.amazonaws.com' then title || ' origin type is not s3.'
    12          when o ->> 'DomainName' like '%s3.amazonaws.com'
    13              and o -> 'S3OriginConfig' ->> 'OriginAccessIdentity' = '' then title || ' origin access identity not configured.'
    14          else title || ' origin access identity configured.'
    15          end as reason,
    16      -- Additional Dimensions
    17      region,
    18      account_id
    19  from
    20      aws_cloudfront_distribution,
    21      jsonb_array_elements(origins) as o;